package com.ifcar.app.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Properties;

public class ProUtil {
	/**
	 * 数据库配置文件
	 */
	private static final String CONFIG_PATH = "config.properties";
	
	private static String basePath = ""; 
	
	public ProUtil(){
		basePath = getClass().getResource("/").getPath() + CONFIG_PATH;
	}
	
	/**
	 * 根据路径获取properties
	 * @param filePath
	 * @return
	 * @throws Exception
	 */
	public Properties getConfigProperties() throws Exception{
		
		File file = new File(basePath);
		if(!file.exists()){
			throw new FileNotFoundException(basePath + " is not found!");
		}
		
		Properties pro = new Properties();
		pro.load(new FileInputStream(file));
		
		return pro;
	}
	
	
}
